Don't double UTF-8 encode in gbfputs(QString, gbfile).
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 18 Feb 2013 05:38:40 +0000 (05:38 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 18 Feb 2013 05:38:40 +0000 (05:38 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4310 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/gbfile.cc

index d0abd48cdef23a8729ff4368900ac86327476730..1a6e86a439bca789c0de434f051fde04a99cbd12 100644 (file)
@@ -780,7 +780,10 @@ gbfputs(const char* s, gbfile* file)
 int
 gbfputs(const QString& s, gbfile* file)
 {
-  const char* qs = xstrdup(s.toUtf8().data());
+  // Why is this Latin1() and not toUtf8()?  Becuase our string data is
+  // already utf8 in most of the "C" places and calling toUtf8() here would
+  // double encode them.
+  const char* qs = xstrdup(s.toLatin1().data());
   unsigned int l = strlen(qs);
   int rv =  gbfwrite(qs, 1, l, file);
   xfree(qs);
@@ -794,7 +797,7 @@ gbfputs(const QString& s, gbfile* file)
 int
 gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file)
 {
-  int result;
+  unsigned int result;
 
   result = file->filewrite(buf, size, members, file);
   if (result != members) {